package base.jdk8_demo.lambda.demo03;

import org.junit.Test;

public class TestLambda {

    /**
     * 打印两数之和
     */
    @Test
    public void test1(){
        MathService.op(100L, 200L, (x,y)-> x+y);
    }

    /**
     * 打印两数之差
     */
    @Test
    public void test2(){
        MathOperation<Long, Long> operation = (x,y)-> x-y;

        MathService.op(200L, 100L, operation);
    }

    @Test
    public void test3(){
        MathService.op(100L, 200L, new MathOperation<Long, Long>() {
            @Override
            public Long getValue(Long t1, Long t2) {
                return t1 * t2;
            }
        });
    }


}
